package com.liu.stockmarket.repository.database.entity

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.liu.stockmarket.model.Stock
import java.math.BigDecimal
import java.time.LocalDate
import java.time.LocalDateTime

@Entity(tableName = "profit")
data class ProfitEntity(
    @PrimaryKey(autoGenerate = true)
    val id: Long? = null,
    /** 类型
     */
    @ColumnInfo(name = "stock_type")
    val stockType: Stock.StockType,

    /**
     * 持有金额
     */

    @ColumnInfo(name = "holding_money")
    val holdingMoney: BigDecimal,
    /**
     *总盈亏金额
     */
    val profit: BigDecimal,
    /**
     * 总收益率
     */
    val percent: BigDecimal,

    /**
     *当天盈亏金额
     */
    @ColumnInfo(name = "today_profit")
    val todayProfit: BigDecimal,

    /**
     * 当天收益率
     */
    @ColumnInfo(name = "today_percent")
    val todayPercent: BigDecimal,

    /**
     * 收益时间
     * */
    val date: LocalDate = LocalDate.now(),

    /**
     * 更新时间
     */
    @ColumnInfo(name = "update_datetime")
    val updateDateTime: LocalDateTime? = LocalDateTime.now(),

    /**
     * 添加时间
     */
    @ColumnInfo(name = "create_datetime")
    val createDateTime: LocalDateTime? = LocalDateTime.now(),
)
